$(document).ready(function(){
  $('#ddldate, #ddlmonth, #ddlyear').live('change', function() {		
			var date = $("#ddldate").val();
			var month = $("#ddlmonth").val();
			var year = $("#ddlyear").val();
			var year = $("#ddlyear").val();
			var testSiteID = $("#testSiteID").val();			
			var location = $("#venueID").val();			
			if(date != "" && month != "" && year != "" && testSiteID!= "")
			{
				$.ajax({
					type: 'POST',
					url: '../../trainees/check_test_time_ajax',
					data: "date=" + date + "&month=" + month + "&year=" + year + "&testsite=" + testSiteID,
					// dataType:"json",
					success: 	function(msg) 
								{
									$('#errormsg').hide();
									$("#errormsg").html("<span style='font-size:11px; font-family: Tahoma; color:#FF0000'>" + msg + "</span>").show();
									// if(msg == '')
									// {
										// $('#submit').attr("disabled", "");
									// }
									// else
									// {
										// $('#submit').attr("disabled", "disabled");
									// }
								}

					// , context:this
				}); 
				if(location != "")
				{
					$.ajax({
						type: 'POST',
						url: '../../trainees/get_timeslot_ajax',
						data: "loc=" + location + "&date=" + date + "&month=" + month + "&year=" + year,
						// dataType:"json",
						success: populateTimeslotList, context:this
					});
				}           
			}
			
        });
});
function populateTimeslotList(response, status) {
	$('#ddltimeslot').html(response); 
	$('#ddltimeslot').show();	
}
